<?php
/**
 * RSS2 Feed Template for displaying RSS2 Posts feed.
 *
 * @package Arlicle
 */

header('Content-Type: text/xml; charset=utf-8', true);
?>
<?php echo '<?xml version="1.0" encoding="utf-8"?'.'>'; ?>

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
>

<channel>
	<title><?php site_title(); ?></title>
	<atom:link href="<?php site_url(); ?>/rss2/" rel="self" type="application/rss+xml" />
	<link><?php site_url(); ?></link>
	<description><?php site_description("description"); ?></description>
	<pubDate><?php echo date('D, d M Y H:i:s +0000'); ?></pubDate>
    <generator>http://www.arlicle.com</generator>
	<language><?php echo get_option('default_language'); ?></language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
<?php
$posts = get_all_posts();
foreach($posts as $post) {
?>
	<item>
		<title><?php echo $post->post_title; ?></title>
		<link><?php echo get_post_url($post->category_url, $post); ?></link>
		<pubDate><?php echo date('D, d M Y H:i:s +0000', $post->post_time); ?></pubDate>
		<dc:creator><?php echo $post->username; ?></dc:creator>

		<guid isPermaLink="false"><?php echo get_post_url($post->category_url, $post); ?></guid>
		<content:encoded><![CDATA[<?php echo $post->post_content; ?>]]></content:encoded>
	</item>
<?php
}
?>
<?php
$all_pages = get_all_pages();
foreach($all_pages as $page) {
    if (strstr($page->url, '/') !== false) {
?>
	<item>
		<title><?php echo $page->title; ?></title>
		<link><?php echo arlicle_url($page->url); ?></link>
		<guid isPermaLink="false"><?php echo arlicle_url($page->url); ?></guid>
		<content:encoded><![CDATA[<?php echo $page->content; ?>]]></content:encoded>
	</item>
<?php
    }
}
?>
</channel>
</rss>
